﻿Public Class frmEscolheTipoDocumento
    Inherits formPadrao

    Public NUM_REGISTRO As Integer
    Public ANO As Integer
    Public ID_TIPO_PERICIA As Integer
    Public ID_NATUREZA As Integer
    Public EHNOVO As Boolean = True
    Private tipoExame As Integer

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCNHFalsa.Click, btnCNHAlterada.Click

        Try
            Dim form As New frmCNH
            form.ucPreambulo.CARREGADADOS = False
            form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
            form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
            form.ucPreambulo.getAno = ANO
            form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
            form.ucPreambulo.ehNovo = EHNOVO
            generica.fechaForms(Me)
            form.MdiParent = Me.ParentForm
            form.Show()
            form.chamaEventoBuscaLaudo(sender, e)

        Catch ex As Exception
            generica.gravaErro(ex)
        End Try
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnCRLVFalso.Click, btnCRLVIrregular.Click
        Try

            Dim form As New frmCLRV

            Select Case CType(sender, Button).Name
                Case "btnCRLVFalso"
                    tipoExame = 0
                Case "btnCRLVAutentico"
                    tipoExame = 1
                Case "btnCRLVAlterado"
                    tipoExame = 2
                Case "btnCRLVIrregular"
                    tipoExame = 3
            End Select


            form.ucPreambulo.CARREGADADOS = False
            form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
            form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
            form.ucPreambulo.getAno = ANO
            form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
            form.ucPreambulo.ehNovo = EHNOVO
            form.tipoExame = tipoExame
            generica.fechaForms(Me)
            form.MdiParent = Me.ParentForm
            form.Show()
            form.chamaEventoBuscaLaudo(sender, e)

        Catch ex As Exception
            generica.gravaErro(ex)
        End Try
    End Sub

    Private Sub frmEscolheTipoDocumento_Load(sender As Object, e As EventArgs) Handles Me.Load


        Select Case ID_NATUREZA

            Case 12 'ALTERACAO
                btnCNHFalsa.Enabled = False
                btnCNHAlterada.Enabled = True
                btnCRLVFalso.Enabled = False
                btnCRLVAutentico.Enabled = False
                btnCRLVAlterado.Enabled = True
                btnCRLVIrregular.Enabled = False
            Case 13 'AUTENTICIDADE
                btnCNHFalsa.Enabled = True
                btnCNHAlterada.Enabled = False
                btnCRLVFalso.Enabled = True
                btnCRLVAutentico.Enabled = True
                btnCRLVAlterado.Enabled = False
                btnCRLVIrregular.Enabled = True
        End Select
    End Sub

    Private Sub btnCRLVIrregular_Click(sender As Object, e As EventArgs) Handles btnCRLVIrregular.Click
        Try

            Dim form As New frmCLRV
            form.ucPreambulo.CARREGADADOS = False
            form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
            form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
            form.ucPreambulo.getAno = ANO
            form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
            form.ucPreambulo.ehNovo = EHNOVO
            form.tipoExame = 3
            generica.fechaForms(Me)
            form.MdiParent = Me.ParentForm
            form.Show()
            form.chamaEventoBuscaLaudo(sender, e)

        Catch ex As Exception
            generica.gravaErro(ex)
        End Try
    End Sub

    Private Sub btnCRLVAlterado_Click(sender As Object, e As EventArgs) Handles btnCRLVAlterado.Click
        Try

            Dim form As New frmCLRV
            form.ucPreambulo.CARREGADADOS = False
            form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
            form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
            form.ucPreambulo.getAno = ANO
            form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
            form.ucPreambulo.ehNovo = EHNOVO
            generica.fechaForms(Me)
            form.MdiParent = Me.ParentForm
            form.Show()
            form.chamaEventoBuscaLaudo(sender, e)

        Catch ex As Exception
            generica.gravaErro(ex)
        End Try
    End Sub

    Private Sub btnCedulaFalsa_Click(sender As Object, e As EventArgs) Handles btnCedulaFalsa.Click
        Dim form As New frmPapelMoeda
        form.ucPreambulo.CARREGADADOS = False
        form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
        form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
        form.ucPreambulo.getAno = ANO
        form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
        form.ucPreambulo.ehNovo = EHNOVO
        form.ehFalso = True
        generica.fechaForms(Me)
        form.MdiParent = Me.ParentForm
        form.Show()
        form.chamaEventoBuscaLaudo(sender, e)
    End Sub

    Private Sub btnCedulaAutentica_Click(sender As Object, e As EventArgs) Handles btnCedulaAutentica.Click
        Dim form As New frmPapelMoeda
        form.ucPreambulo.CARREGADADOS = False
        form.ucPreambulo.txtLaudo.Text = NUM_REGISTRO
        form.ucPreambulo.ID_TIPO_PERICIA = ID_TIPO_PERICIA
        form.ucPreambulo.getAno = ANO
        form.ucPreambulo.ID_NATUREZA = ID_NATUREZA
        form.ucPreambulo.ehNovo = EHNOVO
        form.ehFalso = False
        generica.fechaForms(Me)
        form.MdiParent = Me.ParentForm
        form.Show()
        form.chamaEventoBuscaLaudo(sender, e)
    End Sub
End Class